package com.example.dao;

import com.example.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    /*
    user login
     */
    @Select("SELECT * FROM user where id = #{id} and password = #{password} and deleteUser = #{deleteUser}")
    User login(User user);

    @Select("SELECT * FROM user where name = #{name}")
    User selectUser(User user);
    /*
    user 注册
     */
    @Insert("INSERT into user values (#{id},#{name},#{password} ,#{user_information},0)")
    int addUser(User user);
    /*
    user 修改密码
     */
    @Update("update user set password = ${password} where id = ${id}")
    int changePassword(User user);
    /*
    user 注销
     */
    @Update("update user set deleteUser = 1 where id = #{id} ")
    int deleteUser(User user);
}
